package com.example.socket;

import java.util.Date;

import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class ServerHandler extends IoHandlerAdapter {

	private static Logger logger=LoggerFactory.getLogger(ServerHandler.class);
	public void messageReceived(IoSession session, Object message)
			throws Exception{
		String msg=message.toString();
		logger.info("接收的消息是:{}",msg);
		session.write(new Date());
	}
}
